package ControlLayer;
import ModelLayer.Discount;
import DBLayer.DBDiscount;
import java.util.ArrayList;

public class CtrDiscount {
    // <editor-fold defaultstate="collapsed" desc="Attributes & Constructors">
    private static CtrDiscount instance = null;
    DBDiscount dbDiscount = new DBDiscount();

    public CtrDiscount() {
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    public static CtrDiscount getInstance() {
        if (instance == null) {
            instance = new CtrDiscount();
        }
        return instance;
    }

    public ArrayList<Discount> getDiscountList() {
        return dbDiscount.getDiscountList();
    }

    public Discount getDiscountByID(int id) {
        return dbDiscount.getDiscountByID(id);
    }

    public int addDiscount(Discount discount) {
        return dbDiscount.addDiscount(discount);
    }

    public int updateDiscount(Discount discount, int id) {
        return dbDiscount.updateDiscount(discount, id);
    }

    public void deleteDiscount(int id) {
        dbDiscount.deleteDiscount(id);
    }
    // </editor-fold>
}
